package com.code.condition;

import org.springframework.context.annotation.ImportSelector;
import org.springframework.core.type.AnnotationMetadata;

/**
 * 自定义返回需要导入的组件
 * @see org.springframework.context.annotation.ImportSelector#selectImports(AnnotationMetadata)
 *
 * @author wangjie
 * @version V1.0
 * @date 2020/1/6
 */
public class MyImportSelector implements ImportSelector {

    /**
     *
     * @param annotationMetadata 当前标注@Import的类所有注解信息 {@link org.springframework.core.type.AnnotationMetadata}
     * @return 导入到容器中组件全类名
     */
    @Override
    public String[] selectImports(AnnotationMetadata annotationMetadata) {
        return new String[]{"com.code.bean.Car"};
    }
}
